package appconfig

import (
	"github.com/spf13/viper"
	"github.com/zeromicro/go-zero/core/logx"
)

type AppConfig struct {
	QiNiuYun struct {
		AccessKeyID     string
		AccessKeySecret string
		Bucket          string
		Url             string
	}
}

var AppConf AppConfig

func ApiViper() {
	viper.SetConfigFile("./appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		logx.Error("配置文件读取失败", err)
		panic(err)
	}
	logx.Info("配置文件读取成功")
	err = viper.Unmarshal(&AppConf)
	if err != nil {
		logx.Error("配置文件解析失败", err)
		panic(err)
	}
	logx.Info("配置文件读取成功", AppConf)
}
